﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script src="sha.js" type="text/javascript"></script>
    <script>
        function hashSha1() {
            var pass = document.getElementById('<%=tbPassword.ClientID%>');
            var nonce = document.getElementById('<%=hdNonce.ClientID%>');
            var res = document.getElementById('<%=hdHash.ClientID%>');
            res.value = SHA1(pass.value + nonce.value);
            
            return true;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:HiddenField runat="server" ID="hdNonce" />
        <asp:HiddenField runat="server" ID="hdHash" />
        Password: <asp:TextBox runat="server" ID="tbPassword" />
        <br/>
        <asp:Button runat="server" ID="btnSendPassword" Text="Send Password" 
            onclick="btnSendPassword_Click" OnClientClick="hashSha1()"/>
         <hr />
         <asp:Label runat="server" ID="lbResult" />
    </div>
    </form>
</body>
</html>
